<?php
/**
 * CV item - list
 *
 * @param array $data The data to use for the item
 */
?>

<div class="cv__section">
    <h2><?= $data['label'] ?></h2>

    <?php foreach($data['items'] as $i): ?>
    <p class="cv-item__title"><?= $i['title'] ?></p>

    <?php if(isset($i['dates']) && is_array($i['dates'])): ?>
    <p class="cv-item__dates">
        <time><?= $i['dates']['start'] ?></time>&mdash;<time><?= $i['dates']['end'] ?></time>
    </p>
    <?php endif ?>

    <?php if(is_array($i['description'])): ?>
    <ul>
        <?php foreach($i['description'] as $d): ?>
        <li><?= $d ?></li>
        <?php endforeach ?>
    </ul>

    <?php else: ?>
    <p><?= $i['description'] ?></p>
    <?php endif ?>

    <?php endforeach ?>
</div>
